<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Simple UART driver</title>
<link href="tabs.css" rel="stylesheet" type="text/css" />
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="alias.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="alias.js"></script>

<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>


<script type="text/javascript">
  jQuery(document).ready(function () {
    if(gref){ // Number all _img and _table classes
      gref();
    }
  });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->

<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">nRF51 General Code Examples
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('group__nrf__drivers__simple__uart.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Simple UART driver</div>  </div>
<div class="ingroups"><a class="el" href="group__nrf__drivers.html">Drivers</a></div></div>
<div class="contents">

<p>Simple UART driver.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__nrf__drivers__simple__uart.html#gabae30008064ce450ab819949a692c511">simple_uart_get</a> (void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__nrf__drivers__simple__uart.html#gad4e7d17833960c77c90db7a5cb309a68">simple_uart_get_with_timeout</a> (int32_t timeout_ms, uint8_t *<a class="el" href="group__spi__master__example.html#gae4cee0b144cc6cb01fc4c7b36e37a874">rx_data</a>)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__nrf__drivers__simple__uart.html#ga6346f3ba3f0f1eaaa123064daa3df405">simple_uart_put</a> (uint8_t cr)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__nrf__drivers__simple__uart.html#ga76e6bde269950e02affbff121c79d408">simple_uart_putstring</a> (const uint8_t *str)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__nrf__drivers__simple__uart.html#ga15ab88a2172a5ea02ff41ae9711bc0af">simple_uart_config</a> (uint8_t rts_pin_number, uint8_t txd_pin_number, uint8_t cts_pin_number, uint8_t rxd_pin_number, bool hwfc)</td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<p>Simple UART driver. </p>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="gabae30008064ce450ab819949a692c511"></a><!-- doxytag: member="simple_uart.h::simple_uart_get" ref="gabae30008064ce450ab819949a692c511" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t simple_uart_get </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Reads a character from UART. Execution is blocked until UART peripheral detects character has been received. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>cr Received character. </dd></dl>

<p>Definition at line <a class="el" href="simple__uart_8c_source.html#l00020">20</a> of file <a class="el" href="simple__uart_8c_source.html">simple_uart.c</a>.</p>

</div>
</div>
<a class="anchor" id="gad4e7d17833960c77c90db7a5cb309a68"></a><!-- doxytag: member="simple_uart.h::simple_uart_get_with_timeout" ref="gad4e7d17833960c77c90db7a5cb309a68" args="(int32_t timeout_ms, uint8_t *rx_data)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool simple_uart_get_with_timeout </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>timeout_ms</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>rx_data</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Reads a character from UART with timeout on how long to wait for the byte to be received Execution is blocked until UART peripheral detects character has been received or until the timeout expires, which even occurs first </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>bool True, if byte is received before timeout, else returns False. </dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">timeout_ms</td><td>maximum time to wait for the data. </td></tr>
    <tr><td class="paramname">rx_data</td><td>pointer to the memory where the received data is stored. </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="simple__uart_8c_source.html#l00027">27</a> of file <a class="el" href="simple__uart_8c_source.html">simple_uart.c</a>.</p>

</div>
</div>
<a class="anchor" id="ga6346f3ba3f0f1eaaa123064daa3df405"></a><!-- doxytag: member="simple_uart.h::simple_uart_put" ref="ga6346f3ba3f0f1eaaa123064daa3df405" args="(uint8_t cr)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void simple_uart_put </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>cr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Sends a character to UART. Execution is blocked until UART peripheral reports character to have been send. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">cr</td><td>Character to send. </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="simple__uart_8c_source.html#l00054">54</a> of file <a class="el" href="simple__uart_8c_source.html">simple_uart.c</a>.</p>

</div>
</div>
<a class="anchor" id="ga76e6bde269950e02affbff121c79d408"></a><!-- doxytag: member="simple_uart.h::simple_uart_putstring" ref="ga76e6bde269950e02affbff121c79d408" args="(const uint8_t *str)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void simple_uart_putstring </td>
          <td>(</td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>str</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Sends a string to UART. Execution is blocked until UART peripheral reports all characters to have been send. Maximum string length is 254 characters including null character in the end. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>Null terminated string to send. </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="simple__uart_8c_source.html#l00066">66</a> of file <a class="el" href="simple__uart_8c_source.html">simple_uart.c</a>.</p>

</div>
</div>
<a class="anchor" id="ga15ab88a2172a5ea02ff41ae9711bc0af"></a><!-- doxytag: member="simple_uart.h::simple_uart_config" ref="ga15ab88a2172a5ea02ff41ae9711bc0af" args="(uint8_t rts_pin_number, uint8_t txd_pin_number, uint8_t cts_pin_number, uint8_t rxd_pin_number, bool hwfc)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void simple_uart_config </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>rts_pin_number</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>txd_pin_number</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>cts_pin_number</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>rxd_pin_number</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>hwfc</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Configures UART to use 38400 baud rate. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">rts_pin_number</td><td>Chip pin number to be used for UART RTS </td></tr>
    <tr><td class="paramname">txd_pin_number</td><td>Chip pin number to be used for UART TXD </td></tr>
    <tr><td class="paramname">cts_pin_number</td><td>Chip pin number to be used for UART CTS </td></tr>
    <tr><td class="paramname">rxd_pin_number</td><td>Chip pin number to be used for UART RXD </td></tr>
    <tr><td class="paramname">hwfc</td><td>Enable hardware flow control </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="simple__uart_8c_source.html#l00077">77</a> of file <a class="el" href="simple__uart_8c_source.html">simple_uart.c</a>.</p>

</div>
</div>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>


    <li class="footer">
      Copyright &copy 2006-2011 <a href="http://www.nordicsemi.no" style="text-decoration:none">Nordic Semiconductor</a>.
      All Rights Reserved.
      <a href="disclaimer.html">Disclaimer</a>
    </li>
   </ul>
 </div>


</body>
</html>
